Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issue 924: add support for arrays in scientificMetadata #925

Open
wants to merge 10 commits into
base: master
Choose a base branch
from

Conversation

jkotan
Copy link
Contributor

@jkotan jkotan commented Nov 30, 2023

Description

It resolves #924 by adding support for arrays in scientificMetadata

Motivation

At DESY we often use a list to store vectors

Changes:

  • I add convertArrayToSI function which is called by appendSIUnitToPhysicalQuantity

@jkotan
Copy link
Contributor Author

jkotan commented Dec 1, 2023

Hi,
on the other hand if you don't want to store additional SI values for array because it takes too much space, maybe it would be good to skip arrays conversion without throwing the error as in the current code
(or/and create env VARIABLE to define if you convert or not the arrays to SI or the size of maximal array to be converted).

@jkotan
Copy link
Contributor Author

jkotan commented Dec 1, 2023

I've just added a workaround for #926

@nitrosx nitrosx requested review from bpedersen2 and nitrosx December 1, 2023 09:45
Copy link
Contributor

@bpedersen2 bpedersen2 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Except for some additional comment requests, this looks fine

inputUnit: string,
): { valueSI: number[]; unitSI: string } => {
try {
const newUnit = unit(inputUnit).toSI().toJSON().unit;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can add a comment for this workaround, so that we can easier find to roll back these changes once upstream mathjs has fixed that behaviour ( and if possible reference a mathjs bug report as well)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

#1005 bumped to version with fixed mathjs (see https://github.com/josdejong/mathjs/blob/develop/HISTORY.md#2024-01-12-1230) so we could drop the workaround now.

@bpedersen2 bpedersen2 self-requested a review December 4, 2023 09:46
Copy link
Contributor

@bpedersen2 bpedersen2 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

see my previous comments

@jkotan jkotan requested a review from bpedersen2 December 4, 2023 14:00
Copy link
Contributor

@nitrosx nitrosx left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks fine to me, although it does not address the following:

  • API tests to test specifically this feature
  • fullquery logic and syntax to deal with this new type of metadata.
  • UI to view and edit this type of metadata (this should be a FE PR)

Potentially we could merge this PR, as long as we start working right away on the other two tasks right.
@Junjiequan and myself just discussed about this and we think that it should be discussed at the next meeting.

@nitrosx nitrosx added the meeting Discuss in meeting before merge label Dec 5, 2023
@bpedersen2
Copy link
Contributor

Please check the frontend edit function as well ( it currently seems to truncate the scientific metadata if it encounters an array in the values)!

@jkotan
Copy link
Contributor Author

jkotan commented Jan 19, 2024

Please check the frontend edit function as well ( it currently seems to truncate the scientific metadata if it encounters an array in the values)!

I think the frontend has a separate repository so one need to open a ticket in the dedicated repository

@sbliven
Copy link
Contributor

sbliven commented Sep 10, 2024

What's the status of this PR?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
meeting Discuss in meeting before merge
Projects
None yet
Development

Successfully merging this pull request may close these issues.

add support for arrays in scientificMetadata
4 participants